package com.yygo.webapp.controller;

import com.yygo.service.DealerManager;
import org.appfuse.dao.SearchException;
import org.appfuse.service.GenericManager;
import com.yygo.model.Dealer;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ExtendedModelMap;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

@Controller
@RequestMapping("/dealers*")
public class DealerController {
    private DealerManager dealerManager;

    @Autowired
    public void setDealerManager(@Qualifier("dealerManager") DealerManager dealerManager) {
        this.dealerManager = dealerManager;
    }

    @RequestMapping(method = RequestMethod.GET)
    public Model handleRequest()
    throws Exception {
        Model model = new ExtendedModelMap();
        model.addAttribute(dealerManager.getAll());
        return model;
    }
}
